<template>
    <layout-main :nav="data">
        <card-home title="标讯订阅" icon="/images/home/fuwu.png" hideHeader>
            <recommend></recommend>
        </card-home>

        <guide-popconfirm
            :name="name"
            :list="guideList"
        ></guide-popconfirm>
    </layout-main>
</template>

<script>
import { mapGetters, mapActions } from 'vuex';
import dialogWaitList from '@js/dialog-wait-list.js';

import GuidePopconfirm from '@/components/sys/guide-popconfirm/index.vue';
import Recommend from '@/pages/application/info/section/recommend/index.vue';

import LayoutMain from './layout/main.vue';

import CardHome from './components/card-home.vue';

import HOME_MAIN_MIXIN from './mixins/main.js';

export default {
    mixins: [HOME_MAIN_MIXIN],
    components: {
        GuidePopconfirm,
        Recommend,
        LayoutMain,
        CardHome,
    },
    data() {
        return {
            name:"",
            guideList: [],
            
            guideGroup: {
                home:{
                    name:"guide-home",
                    guideList: [
                        {
                            title: '自研小工具，让工作更效率',
                            placement: 'bottom',
                            btn: '下一步',
                            position: {
                                right: '130px',
                                top: 0,
                            },
                            fixed: true,
                            size: [750, 80],
                        },
                        {
                            title: '常用功能，都在这里',
                            placement: 'right',
                            btn: '下一步',
                            position: [6, 106],
                            size: [164, 40],
                        },
                        {
                            title: '招投标常用网站大全，应有尽有',
                            placement: 'right',
                            btn: '下一步',
                            position: [6, 140],
                            size: [164, 40],
                        },
                        {
                            title: '想要的标讯都在这里',
                            placement: 'left',
                            btn: '开始使用吧',
                            position: [196, 100],
                            size: [1000, 600],
                        },
                    ],
                },
                //监控企业
                business:{
                    name:'guide-monitor-business',
                    guideList:[
                        {
                            title: '点击选择查企业',
                            placement: 'bottom',
                            btn: '下一步',
                            position: [630, 120],
                            // fixed: true,
                            size: [100, 40],
                        },
                        {
                            title: '输入要查看的企业名称',
                            placement: 'left',
                            btn: '下一步',
                            position: [260, 150],
                            size: [865, 55],
                        },
                        {
                            title: '点击关注进行监控该企业，进入“我的桌面”查看',
                            placement: 'left',
                            btn: '开始使用吧',
                            position: {
                                right: '6px',
                                top: '240px',
                            },
                            size: [50, 36],
                        },
                    ]
                },
                //首页-企业画像
                homeBusiness:{
                    name:'guide-home-business',
                    guideList:[
                        {
                            title: '点击选择查企业',
                            placement: 'bottom',
                            btn: '下一步',
                            position: [630, 120],
                            size: [100, 40],
                        },
                        {
                            title: '输入要查看的企业名称',
                            placement: 'left',
                            btn: '下一步',
                            position: [260, 150],
                            size: [865, 55],
                        },
                        {
                            title: '点击查看企业',
                            placement: 'right',
                            btn: '开始使用吧',
                            position: [200, 230],
                            size: [500, 50],
                        },
                    ]
                },
            }
        };
    },
    methods: {
        ...mapActions({
            showLogin: 'global-dialog/showLogin',
        }),
        getGuide() {
            var type = this.getQuery('recommend_type') || 'home';
            var position = this.getQuery('position') || '';

            if( type=== 'business' && position === 'home'){
                type = 'homeBusiness'
            } 

            this.name = this.guideGroup[type].name;
            this.guideList = this.guideGroup[type].guideList;
        },
    },
    mounted() {
        this.getGuide();
        
        var SERIAL_CODE = this.$cookies.get('SERIAL_CODE'),
                ssc = this.getQuery('ssc');

        if (!SERIAL_CODE && ssc) {
            // 没登录，地址栏有ssc

            // 在列队中注册-分享引导登录
            dialogWaitList.push(() => {
                this.showLogin({
                    name: 'login',
                    theme: 'share',
                    context: '在当前界面注册成功后，您和好友均可获得5次投标方案下载次数',
                });
            });
        }
    },
};
</script>

<style lang="scss" scoped>

</style>